package com.ybt.heartratem.logic.data.http.service;

import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ybt.heartratem.BuildConfig;
import com.ybt.heartratem.common.entity.ClassInfo;
import com.ybt.heartratem.common.entity.StudentInfo;
import com.ybt.heartratem.common.entity.TeacherInfo;
import com.ybt.heartratem.logic.data.http.service.entry.AASRequestBody;

import java.util.List;

import io.reactivex.Observable;
import me.goldze.mvvmhabit.http.BaseResponse;
import me.goldze.mvvmhabit.http.UploadParam;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * http数据接口定义
 */
public interface AASApiService {
    /***
     * 获取班级列表
     * @param SchoolID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Health/GetClassList")
    @FormUrlEncoded
    Observable<BaseResponse<List<ClassInfo>>> getClassList(@Field("SchoolID") String SchoolID);


    /***
     * 获取教工列表
     * @param SchoolID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Health/GetEmployeeList")
    @FormUrlEncoded
    Observable<BaseResponse<List<TeacherInfo>>> GetEmployeeList(@Field("SchoolID") String SchoolID);

    /***
     * 获取学生列表
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Health/GetStudentList")
    @FormUrlEncoded
    Observable<BaseResponse<List<StudentInfo>>> getStudentList(@Field("SchoolID") String SchoolID, @Field("ClassID") int ClassID);

    /***
     * 获取上传OSS的签名参数
     * @param FileName
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Activity/OssSignature")
    @FormUrlEncoded
    Observable<UploadParam> getOssSignData(@Field("FileName") String FileName);


    /***
     * 根据业务模块编码获取业务列表数据
     * @param schoolID
     * @param ModelType
     * @param PageIndex
     * @param PageSize
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Form2/SearchRecord")
    @FormUrlEncoded
    Observable<JsonObject> getRecordList(@Field("SchoolID") int schoolID,
                                         @Field("ModelType") int ModelType,
                                         @Field("PageIndex") int PageIndex,
                                         @Field("PageSize") int PageSize);

    /***
     * 根据业务ID获取业务数据
     * @param ID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Form2/GetRecord")
    @FormUrlEncoded
    Observable<JsonObject> getRecordByID(@Field("ID") int ID);

    /***
     * 新增业务数据
     * @param body
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Form2/AddRecord")
    Observable<ResponseBody> AddRecord(@Body AASRequestBody body);

    /***
     * 修改业务数据
     * @param body
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Form2/UpdateRecord")
    Observable<ResponseBody> UpdateRecord(@Body AASRequestBody body);

    /***
     * 删除业务数据
     * @param ID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Form2/DeleteRecord")
    @FormUrlEncoded
    Observable<ResponseBody> DeleteRecord(@Field("ID") int ID);

    /***
     * 根据角色类型获取教工列表
     * @param SchoolID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Health/GetEmployeeList")
    @FormUrlEncoded
    Observable<BaseResponse<List<TeacherInfo>>> GetEmployeeList(@Field("SchoolID") String SchoolID, @Field("RoleID") int RoleID);

    /***
     * 获取餐点食谱
     * @param SchoolID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Kitchen/SearchCookBook")
    @FormUrlEncoded
    Observable<JsonArray> getFoodBook(@Field("SchoolID") String SchoolID,
                                      @Field("TypeOf") String TypeOf,
                                      @Field("DateFrom") String DateFrom,
                                      @Field("DateTo") String DateTo);


    /***
     * 获取学校信息
     * @param SchoolID
     * @return
     */
    @POST(BuildConfig.BASE_SERVER_URL + "Common/GetSchoolInfo")
    @FormUrlEncoded
    Observable<JsonObject> getSchoolInfo(@Field("ID") int SchoolID);

}
